package com.min.juc.utilclass.countdownlatch;

import java.util.concurrent.CountDownLatch;

public class CountDownLatchDemo01 {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch = new CountDownLatch(6);

        for (int i = 0; i < 6; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName() + "go out");
                countDownLatch.countDown();  //计数器-1
            },String.valueOf(i)).start();
            
        }
        countDownLatch.await(); //计数器归零 ,向下运行
        System.out.println("close Door");
    }
}
